/*
 *  $Id: Night.cs 1067 2010-05-21 11:00:43Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Darkness.Spells {
    public class Night: SelfEnchantmentCard {
        public Night(): base("001_d_s_night") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Darkness;
            Value = 100;
            AddManaCost(ElementType.Darkness, 4);
        }

        protected override EnchantmentAffect CreateEnchantment() {
            return new NightAffect();
        }

        private class NightAffect: EnchantmentAffect<Night> {
            public NightAffect() {
                Add(new NightAura());
            }
        }

        private class NightAura: CreatureAuraAffect {
            public NightAura(): base(true, true) {}

            public override string Id {
                get { return AffectManager.GetCardId<Night>("aura"); }
            }

            public override int AverageWeightPercent {
                get { return 600; }
            }

            protected override bool AcceptCreature(Creature cr) {
                return cr.Card.Element == ElementType.Darkness || cr.IsUndead;
            }

            protected override Affect CreateSubAffect() {
                return new NightAuraAffect();
            }
        }

        private class NightAuraAffect: SpellAffect<Night> {
            public NightAuraAffect() {
                Add(new Affects.Tireless());
                Add(new Affects.Fast(2));
            }
        }
    }
}
